﻿using System.Linq;
using Microsoft.AspNetCore.Mvc;
using SaaS.Model.Enums;
using XCore.Extensions;

namespace Web.Client.Controllers
{
    /// <summary>
    /// 客户端配置信息
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BasicsController : ClientControllerBase
    {
        /// <summary>
        /// 初始化配置信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Init()
        {
            return Ok(SCC.Basics.Where(c => c.Status == ArticleStatus.Published).Select(c => new
            {
                Images = c.Images.ToEnumerable<string>(","),
                c.Sort,
                c.Tag,
                c.Title,
                c.Type
            }));
        }
    }
}